﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using WcfService.CtrlLayer;
using WcfService.ModelLayer;
using WcfService.DBLayer;

namespace WcfService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class Service1 : IService1
    {

        private CtrlVotingResults ctrl = new CtrlVotingResults();
        private DBVotingResults db = new DBVotingResults();

        public int SaveResult(int episodeId)
        {
            ctrl.SaveResults();
            return 0;
        }

        public void MakeChoice(Option vResult)
        {
            int choice = vResult.Choice;
            int episodeId = vResult.EpisodeId;
            ctrl.makeChoice(episodeId, choice);
        }

        public void SaveRegId(User user)
        {
            string regId = user.RegId;
            ctrl.SaveRegId(regId);
        }

        public void SaveVehicle(Vehicle vehicle)
        {
            Console.WriteLine("" + vehicle.Make);
            db.SaveResultV();
        }

        public VoteObject GetVoteObject(string episodeId)
        {
            int epId = Convert.ToInt32(episodeId);
            VoteObject vote = ctrl.voteResult(epId);
            return vote;
        }
    }
}
